﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace YERIL_PI_INT.PaginasWebs.Modulos.Login
{
    public partial class I_REPT_TOT_PROY_BY_CLIENTE : System.Web.UI.Page
    {
        int Cliente = 0;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Cargar_Combos();
                dlClient.SelectedValue = "1";
            }

        }

        protected void btnGenerarReporte_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                WSGestion.WSGestion wsgest = new WSGestion.WSGestion();
                wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs");
                Cliente = Convert.ToInt32(dlClient.SelectedValue.ToString());

                if (Cliente != null)
                {

                    Session["Cliente"] = Cliente;
                    Response.Redirect("REPT_TOT_PROY_BY_CLIENTE.aspx");
                }


            }
            catch (Exception)
            {

                throw;
            }



        }


        private void Cargar_Combos()
        {
            try
            {
                WSGestion.WSGestion wsgest = new WSGestion.WSGestion();
                wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs");
                List<WSGestion.MOD_Clientes> ListaClientes = wsgest.SEL_GRID_CLIENTES().ToList();
                this.dlClient.DataSource = ListaClientes;
                this.dlClient.DataValueField = "CLI_codcliente";
                this.dlClient.DataTextField = "CLI_nombre";
                this.dlClient.DataBind();

            }
            catch (Exception exc)
            {
                throw exc;
            }
        }
    }
}